home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Communication / NewsBase / Source / INXBrowserCellWithLinkedObject.m < prev    next >
Text File  |  1993-01-12  |  3KB  |  138 lines

  1. /*$Copyright:
  2.  * Copyright (C) 1992.5.22. Recruit Co.,Ltd. 
  3.  * Institute for Supercomputing Research
  4.  * All rights reserved.
  5.  * NewsBase  by ISR, Kazuto MIYAI, Gary ARAKAKI, Katsunori SUZUKI, Kok-meng Lue
  6.  *
  7.  * You may freely copy, distribute and reuse the code in this program under 
  8.  * following conditions.
  9.  * - to include this notice in the source code, if it is to be distributed 
  10.  *   with source code.
  11.  * - to add the file named "COPYING" within the code, which shall include 
  12.  *   GNU GENERAL PUBLIC LICENSE(*).
  13.  * - to display an acknowledgement in binary code as follows: "This product
  14.  *   includes software developed by Recruit Co.,Ltd., ISR."
  15.  * - to display a notice which shall state that the users may freely copy,
  16.  *   distribute and reuse the code in this program under GNU GENERAL PUBLIC
  17.  *   LICENSE(*)
  18.  * - to indicate the way to access the copy of GNU GENERAL PUBLIC LICENSE(*)
  19.  *
  20.  *   (*)GNU GENERAL PUBLIC LICENSE is stored in the file named COPYING
  21.  * 
  22.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  23.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  24.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  25. $*/
  26.  
  27. #import "INXBrowserCellWithLinkedObject.h"
  28. #import <appkit/Text.h>
  29. #import <appkit/NXImage.h>
  30. #import <dpsclient/psops.h>
  31.  
  32. #define        FIELD_LMARGIN        10
  33. #define        MARGIN        2
  34.  
  35. @implementation INXBrowserCellWithLinkedObject
  36.  
  37. - init
  38. {
  39.     [super init];
  40.     iNode = nil;
  41.     iListnode = nil;
  42.     activeFlag = YES;
  43.     iImage = nil;
  44.  
  45.     return self;
  46. }
  47.  
  48. - node
  49. {
  50.     return iNode;
  51. }
  52.  
  53. - setNode:node
  54. {
  55.     iNode = node;
  56.     return self;
  57. }
  58.  
  59. - listnode
  60. {
  61.     return iListnode;
  62. }
  63.  
  64. - setListnode:listnode
  65. {
  66.     /* listnode will be free in ITreeBrowser */
  67.     iListnode = listnode;
  68.     return self;
  69. }
  70.  
  71. - setActive:(BOOL)flag
  72. {
  73.     activeFlag = flag;
  74.     return self;
  75. }
  76.  
  77. - (BOOL)active
  78. {
  79.     return activeFlag;
  80. }
  81.  
  82. - toggleActive
  83. {
  84.     if (activeFlag == YES) {
  85.     [self setActive:NO];
  86.     } else {
  87.     [self setActive:YES];
  88.     }
  89.     return self;
  90. }
  91.  
  92. - free
  93. {
  94.     if (iListnode != nil) {    
  95.         [iListnode free];
  96.     }
  97.  
  98.     return ([super free]);
  99. }
  100.  
  101. - setTextAttributes:textObj
  102. {
  103.     [super setTextAttributes:textObj];
  104.     if (activeFlag == YES) {
  105.     [textObj setTextGray:NX_BLACK];
  106.     } else {
  107.     [textObj setTextGray:NX_DKGRAY];
  108.     }
  109.     return textObj;
  110. }
  111.  
  112. - setImage:image
  113. {
  114.     iImage = image;
  115.     return self;
  116. }
  117.  
  118. - drawInside:(const NXRect *)cellFrame inView:controlView
  119. {
  120.     NXCoord    baseX, baseY;
  121.     NXPoint    imagePoint;
  122.     
  123.     // do normal stuff first
  124.     [super drawInside:cellFrame inView:controlView];
  125.     
  126.     // draw image for cell
  127.     baseX = NX_X(cellFrame);
  128.     baseY = NX_Y(cellFrame);
  129.  
  130.     imagePoint.x = NX_WIDTH(cellFrame) - 15.0;
  131.     imagePoint.y = NX_Y(cellFrame) + NX_HEIGHT(cellFrame) - 2.0;
  132.  
  133.     [iImage composite:NX_SOVER toPoint:&imagePoint];
  134.     return self;
  135. }
  136.  
  137. @end
  138.